---
description: "Reference for Nitric's Dart library - Creates a new Queue to process asynchronous messages."
---

# Dart - queue()

<Note>
  This is reference documentation for the Nitric Dart SDK. To learn about Queues
  in Nitric start with the [Async Messaging docs](/messaging#queues).
</Note>

Creates a new Queue to process asynchronous messages.

```dart
import 'package:nitric_sdk/nitric.dart';

final batchQueue = Nitric.queue("batch").allow([
  QueuePermission.enqueue,
  QueuePermission.dequeue,
]);
```

## Parameters

<Properties>
  <Property name="name" required type="String">
    The unique name of this Queue within the service. Subsequent calls to
    `queue` with the same name will return the same object.
  </Property>
</Properties>

## Access

All Nitric resources provide access permissions you can use to specify the level of access your service needs to the resource. See here for details about infrastructure [security](/get-started/foundations/infrastructure/security).

### Available permissions:

---

**QueuePermission.enqueue**

This permission allows your service to enqueue new messages.

---

**QueuePermission.dequeue**

This permission allows your service to dequeue messages and complete them.

---

### Notes

In most instances, code should either enqueue or dequeue from a queue, usually not both.

## Examples

### Create a Queue

```dart
import 'package:nitric_sdk/nitric.dart';

final batchQueue = Nitric.queue("batch").allow([
  QueuePermission.enqueue,
  QueuePermission.dequeue,
]);
```

### Enqueue messages

```dart
import 'package:nitric_sdk/nitric.dart';

final batchQueue = Nitric.queue("batch").allow([
  QueuePermission.enqueue,
  QueuePermission.dequeue,
]);

final messages = []

await batchQueue.enqueue(messages);
```
